package com.demomaster.quickaccessibility.service;

public class QuickAccessibility {
    private static QuickAccessibility instance;

    public static QuickAccessibility getInstance() {
        if(instance==null){
            instance = new QuickAccessibility();
        }
        return instance;
    }
    
    private QuickAccessibility() {
    }
    BaseAccessibilityService accessibilityService;

    public BaseAccessibilityService getAccessibilityService() {
        return accessibilityService;
    }

    public void onAccessibilityEvent(QuickAccessibilityEvent quickAccessibilityEvent) {
        if(accessibilityListener!=null){
            accessibilityListener.onAccessibilityEvent(quickAccessibilityEvent);
        }
    }

    public void performGlobalAction(AccessibilityAction eventMessage){
        QuickAccessibilityService.instance.performGlobalAction(eventMessage);
    }

    public void onServiceCreate(BaseAccessibilityService instance) {
        accessibilityService=instance;
        if(accessibilityListener!=null){
            accessibilityListener.onServiceCreate(instance);
        }
    }
    public AccessibilityListener accessibilityListener;

    public void setAccessibilityListener(AccessibilityListener accessibilityListener) {
        this.accessibilityListener = accessibilityListener;
    }

    public void onServiceDestroy() {
        if(accessibilityListener!=null){
            accessibilityListener.onServiceDestroy();
        }
    }
}
